package ctrl;

import javax.swing.*;

public class UICtrl {
    //全局对象
    private JTextArea jta;

    public UICtrl(JTextArea jta) {
        this.jta = jta;
    }

    //交互处理
    public void mutual() {
        String cmd = jta.getText().substring(jta.getText().lastIndexOf("> ") + 2, jta.getText().length());

        input();
    }

    //换行处理
    public void input() {
        jta.append("> ");
        jta.requestFocus();
        jta.setCaretPosition(jta.getText().length());
    }
}
